#include <stdio.h>
#include <limits.h>
#include <ctype.h>

double * copy_arr(double[], const double[], int);
double * copy_ptr(double[], const double[], int);
double * copy_ptrs(double *, const double *, const double *);

int main(void)
{
    double source[5] = {1.1, 2.2, 3.3, 4.4, 5.5};
    double target1[5], target2[5], target3[5];

    copy_arr(target1, source, 5);
    copy_ptr(target2, source, 5);
    copy_ptrs(target3, source, source + 5); int i; printf("targe1:\n");
    for (i=0; i<5; ++i) {
        printf("%.2lf ", target1[i]);
    }

    printf("\ntarge1:\n");
    for (i=0; i<5; ++i) {
        printf("%.2lf ", target2[i]);
    }

    printf("\ntarge1:\n");
    for (i=0; i<5; ++i) {
        printf("%.2lf ", target3[i]);
    }

    putchar('\n');
    return 0;
}


double * copy_arr(double * dst, const double * src, int num) {
    int i;

    for (i=0; i<num; ++i) {
        dst[i] = src[i];
    }

    return dst;
}

double * copy_ptr(double * dst, const double * src, int num) {
    int i;
    double * co = dst;

    while (i++ < num)
        *(co++) = *(src++);

    return dst;
}

double * copy_ptrs(double * dst,const double * src, const double * end) {
    double * co = dst;
    for (;src < end; ++src, ++co)
        *co = *src;

    return dst;
}
